/***************************************************************************
 * 文件名：FMInputBox
 * 功能：
 * 说明：
 * -------------------------------------------------------------------------
 * 创建时间：2025/7/14 20:28:00
 * 创建人：葛浩
 * 邮箱： 2094733071@qq.com
 * =========================================================================
 *
 * 修改人：   
 * 修改时间：   
 * 修改说明：   
 ***************************************************************************/
using DevExpress.XtraEditors;
using System;
using System.Windows.Forms;

namespace BuiltInTools
{
	public partial class FMInputBox : XtraForm
	{
		private string _InputValue;
		public string InputValue
		{
			get { return _InputValue; }
			set { _InputValue = value; }
		}

		private string _refType;

		public FMInputBox(string refType)
		{
			InitializeComponent();
			_refType = refType;
		}
		private void FMInputBox_Load(object sender, EventArgs e)
		{
			GetLabelText(_refType);
		}

		/// <summary>
		/// 确认
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void btnConfirm_Click(object sender, EventArgs e)
		{
			if (string.IsNullOrEmpty(txtInputValue.Text))
			{
				MessageBox.Show($"{labelControl1.Text}的值不能为空！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
				return;
			}

			InputValue = txtInputValue.Text;
			DialogResult = DialogResult.OK;
		}
		
		/// <summary>
		/// 关闭
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void btnClose_Click(object sender, EventArgs e)
		{
			DialogResult = DialogResult.Cancel;	
		}

		/// <summary>
		/// 解析引用类型显示不同的label文本
		/// </summary>
		/// <param name="refType"></param>
		private void GetLabelText(string refType)
		{
			switch (refType)
			{
				case ReferenceTypeConst.Ref:
					labelControl1.Text = "程序集相对地址:";
					break;
				case ReferenceTypeConst.ProjRef:
					labelControl1.Text = "项目相对地址:";
					break;
				case ReferenceTypeConst.PkgRef:
					labelControl1.Text = "包名称:";
					break;
				default:
					break;
			}
		}
	}
}
